package com.dfrz.stockMarket.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dfrz.stockMarket.bean.MessageBean;
import com.dfrz.stockMarket.model.UserInfoModel;
import com.dfrz.stockMarket.service.UserService;

public class RegisterActionCtrl extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


		String path = req.getContextPath();
		String name=req.getParameter("regname");
		String pwd=req.getParameter("pwd");
		UserInfoModel userinfo=new UserInfoModel();
		
		userinfo.setUserName(name);
		userinfo.setUserPassWord(pwd);
		
		try {
			MessageBean msgb=UserService.saveUserInfo(userinfo);
			System.out.println(msgb.isSuccess());
			req.setAttribute("path", path);
			req.getRequestDispatcher("/WEB-INF/page/index.jsp").forward(req, resp);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//接收参数
		

	}
}
